import { EntitySchema } from '@mikro-orm/core';

export class ImsYzdKpUsersCar {
  id!: number;
  userId!: number;
  goodId!: number;
  num!: number;
  unitPrice!: string;
  totalPrice!: string;
  goodsInfo!: unknown;
  goodsStr!: unknown;
  signId!: string;
  addTime!: string;
  updateTime!: string;
  uniacid!: number;
}

export const ImsYzdKpUsersCarSchema = new EntitySchema({
  class: ImsYzdKpUsersCar,
  properties: {
    id: { primary: true, type: 'number' },
    userId: { type: 'number', index: 'user_id' },
    goodId: { type: 'number', index: 'good_id' },
    num: { type: 'number' },
    unitPrice: { type: 'string', columnType: 'numeric(10,2)' },
    totalPrice: { type: 'string', columnType: 'numeric(10,2)', defaultRaw: `0.00` },
    goodsInfo: { type: 'unknown', columnType: 'longtext' },
    goodsStr: { type: 'unknown', columnType: 'longtext' },
    signId: { type: 'string', length: 255, default: '-1' },
    addTime: { type: 'string', length: 255 },
    updateTime: { type: 'string', length: 255 },
    uniacid: { type: 'number', index: 'uniacid' },
  },
});
